import {IUserInfo} from "../../interface/login";
import {MENU_OPEN_KEYS, USER_INFO} from "../../constant/app";

export interface IAppState{
    loginSuccessUri:string,
    menuCollapsed:boolean,
    userInfo?:IUserInfo,
    openKeys?:any[]
}

const userInfoStr=localStorage.getItem(USER_INFO)
let userInfo:IUserInfo=null;
if(userInfoStr){
    userInfo=JSON.parse(userInfoStr)
}

const localOpenKeysStr=localStorage.getItem(MENU_OPEN_KEYS)
console.log("getOpenKeys",localOpenKeysStr)
let localOpenKeys=[]
if(localOpenKeysStr){
    localOpenKeys=JSON.parse(localOpenKeysStr)
}
export const appState:IAppState={loginSuccessUri:"/",menuCollapsed:false,userInfo,openKeys:localOpenKeys}
